<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Novo Calendarios</title>
        <script type="text/javascript" src="../js/jquery.js" ></script>
        <script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js" ></script>
        <script type="text/javascript" src="../js/jquery.ui.datepicker-pt-BR.js" ></script>
        <script type="text/javascript" src="../js/jquery.validate.js"></script>
        <script type="text/javascript" src="../js/forms.js"></script>
        <link rel="stylesheet" href="../css/forms.css">
        <link rel="stylesheet" href="../css/ui-lightness/jquery-ui-1.8.2.custom.css">
    </head>
    <script>
        $(document).ready(function(){
            $("#data_calendario").datepicker();

            $("#form").validate({
                rules: {
                    data_calendario: {required: true}
                    ,id_unidade: {digits: true
                    }
                    ,desc_calendario: {required: true}
                    ,diautil_calendario: {required: true}
                },
                submitHandler: function(form) {
                    salvar(form);
                }
            });


        });
    </script>

    <body>
        <form name="form" id="form" method="post" action="insert.jsp" >
            <fieldset><legend>Dados</legend>
                <p><label class="lbInput">Data<em>*</em></label>
                    <input type="text" id="data_calendario" name="data_calendario" size="10" maxlength="10" class="required"
                           value="${param.data}">
                </p>
                <p><label class="lbInput">Cidade<em>*</em></label>
                    <sql:query var="queryCidade" dataSource="jdbc/dbo_MicrosoftSQLServer">
                        SELECT  * FROM Cidades
                        order by nome_cidade
                    </sql:query>
                    <select name="id_cidade" class="required">
                        <option value="0">Todas</option>
                        <c:forEach var="cidade" items="${queryCidade.rows}">
                            <option value="${cidade.id_cidade}" ${cidade.id_cidade==param.id_cidade?'selected':''}>${cidade.nome_cidade}</option>
                        </c:forEach>
                    </select>
                </p>
                <p><label class="lbInput">Descrição<em>*</em></label>
                    <input type="text" name="desc_calendario"
                           size="50" maxlength="50" class="required" value="">
                </p>
                <p><label class="lbInput">Dia útil?<em>*</em></label>
                    <select name="diautil_calendario" class="required">
                        <option value="S">Sim</option>
                        <option value="N">Não</option>

                    </select>
                </p>
                <p>
                    <input class="submit" type="submit" value="Salvar">
                </p>
                <div id="ajax_dados" style="display:block">
                </div>
                <div id="msg" style="display:inline">

                </div>
            </fieldset>
        <input type="hidden" id="token" name="token" value="${sessionScope.token}" /> </form>
    </body>
</html>
